package com.xuecheng.controller;

import com.xuecheng.entity.Student;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @author 黄子弟
 * @Date 2021/12/7
 */

@Api(tags = "swagger注解测试",description = "老版本")
public interface HelloControllerApi {
    @GetMapping("hello")
    @ApiOperation("无参数测试")
    String hello();

    @GetMapping
    @ApiOperation("queryString传参测试")
    @ApiImplicitParam(name = "num",value = "编号",required = true,dataType = "String",paramType = "query")
    Student modifyStudentNum(@RequestParam("num") String num);

    @GetMapping("{name}")
    @ApiOperation("path路径传参测试")
    @ApiImplicitParam(name = "name",value = "姓名",required = true,dataType = "String",paramType = "path")
    Student modifyStudentName(@PathVariable("name") String name);

    @PostMapping
    @ApiOperation("requestBody请求体传参测试")
    Student modifyStudent(@RequestBody Student student);

    @PutMapping("{id}")
    @ApiOperation("混合传参测试")
    @ApiImplicitParams({@ApiImplicitParam(name = "id",value = "id标识",required = true,dataType = "String",paramType = "path"),
    @ApiImplicitParam(name = "name",value = "姓名",required = true,dataType = "String",paramType = "query")})
    Student mofidyStudentBynNum(@PathVariable("id") String id, @RequestParam("name") String name, @RequestBody Student student);
}
